const koaTool = require('../../commons/koa_tool')
const ossServer = require('../services/oss.js');


class SystemController {

    getOssConfig = async (ctx) => {
        let ossConfig = await ossServer.getOssConfig();
        return koaTool.succ(ctx, {
            ossConfig
        })
    }

    // TODO 获取Mqtt参数
    getMqttClientConfig = async (ctx) => {
        let mqttOpt = {
            url: 'ws://175.27.190.12:8083/mqtt',
            username: "jyq",
            password: "123456",
            clientId: `vue-client_${Math.floor(Math.random() * 100).toString(36)}`,
            clear: true,
            connectTimeout: 4000,
            reconnectPeriod: 1000
        }
        return koaTool.succ(ctx, {
            mqttOpt
        })
    }
}

module.exports = new SystemController()

